/*
 * FlicrkPanelUpload.java
 *
 * Created on 19 janvier 2008, 11:27
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package flickr;

import images.TabsDeDroite;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import principal.Fenetre;

/**
 *
 * @author Administrateur
 */


public class FlickrPanel extends JPanel {
    
    
    FlickrPanelDownload leFlickrPanelDownload;
    FlickrPanelUpload leFlickrPanelUpload;
    
        private JTextArea console;
    
    /** Creates a new instance of FlicrkPanelUpload */
    public FlickrPanel(FlickrUzine leFlickrModel, TabsDeDroite lesTabs, Fenetre parent) {
        
        leFlickrModel.setFlickrPanel(this);
        
        leFlickrPanelDownload = new FlickrPanelDownload(this,leFlickrModel,lesTabs,parent);
        leFlickrPanelUpload = new FlickrPanelUpload(this,leFlickrModel,lesTabs,parent);
        
        JTabbedPane leJTabbedPane = new JTabbedPane();
        leJTabbedPane.add("Upload",leFlickrPanelUpload);
        leJTabbedPane.add("Download", leFlickrPanelDownload);
        
        
        setLayout(new BorderLayout());
        add(leJTabbedPane,BorderLayout.NORTH);
       
        
             
        
        console = new JTextArea();
        console.setLineWrap(true);
        console.setEditable(false);
        Font maFont = new Font("Verdana", Font.PLAIN, 10);
        console.setFont(maFont);
        
        JScrollPane leScrollPanedeConsole = new JScrollPane(console);
        leScrollPanedeConsole.setPreferredSize(new Dimension(200,200));
        
        
        add(leScrollPanedeConsole, BorderLayout.CENTER);
        
    }
    
    
    public FlickrPanelDownload getFlickrPanelDownload(){
        return leFlickrPanelDownload;
    }
    
    public FlickrPanelUpload getFlickrPanelUpload(){
        return leFlickrPanelUpload;
    }
    
    
       public void ajouterConsole(String texte){
        console.append(texte);
        console.setCaretPosition(console.getDocument().getLength());  // provoque l'auto scroll lors d'ajout
    }
    
}
